<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Tab - Tab</title><meta name="author" content="Tab"><meta name="copyright" content="Tab"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Tab">
<meta property="og:type" content="website">
<meta property="og:title" content="Tab">
<meta property="og:url" content="https://tabxx.github.io/tab.github.io/index.html">
<meta property="og:site_name" content="Tab">
<meta property="og:description" content="Tab">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://tabxx.github.io/tab.github.io/images/avatar.jpg">
<meta property="article:author" content="Tab">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://tabxx.github.io/tab.github.io/images/avatar.jpg"><link rel="shortcut icon" href="/tab.github.io/images/favicon.ico"><link rel="canonical" href="https://tabxx.github.io/tab.github.io/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/tab.github.io/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?050bcda3cb147a8c0de1c17a337c5466";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = { 
  root: '/tab.github.io/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Tab',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2021-08-13 17:11:40'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
          const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
          const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
          const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified

          if (t === undefined) {
            if (isLightMode) activateLightMode()
            else if (isDarkMode) activateDarkMode()
            else if (isNotSpecified || hasNoSupport) {
              const now = new Date()
              const hour = now.getHours()
              const isNight = hour <= 6 || hour >= 18
              isNight ? activateDarkMode() : activateLightMode()
            }
            window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
              if (saveToLocal.get('theme') === undefined) {
                e.matches ? activateDarkMode() : activateLightMode()
              }
            })
          } else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><meta name="generator" content="Hexo 5.1.1"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src= "" data-lazy-src="/tab.github.io/images/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/tab.github.io/archives/"><div class="headline">文章</div><div class="length-num">10</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tab.github.io/tags/"><div class="headline">标签</div><div class="length-num">7</div></a></div></div></div><hr/></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/tab.github.io/images/bg.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/tab.github.io/">Tab</a></span><div id="menus"><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">Tab</h1></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/tab.github.io/2021/08/09/femonitor/" title="前端异常监控平台">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2021/08/09/femonitor/IMG_2992.jpeg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="前端异常监控平台"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2021/08/09/femonitor/" title="前端异常监控平台">前端异常监控平台</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-08-09T12:25:00.000Z" title="发表于 2021-08-09 20:25:00">2021-08-09</time></span></div><div class="content">背景前端项目发布到生产环境之后，线上问题几乎都需要用户投诉等渠道通知到开发人员，开发人员根据描述还原场景，定位问题再修复之，这样效率极低，影响用户体验和开发工作效率。因此一些前端监控平台就应运而生了，目前比较主流的框架有：

sentry 
fundebug 
webfunny 
ARMS 

为什么不用这些成熟的框架呢？首先这些框架都是收费的，费用不低，且存在数据泄漏的风险；其次平台二次开发受限，无法根据自身业务定制功能。所以搭建一套私有化的前端监控平台还是很有价值的，主要是能提高开发者排查问题，在用户投诉前发现问题并解决问题，减少用户投诉率。
整体架构前端监控平台一般有四部分组成：日志采集、日志存储、日志分析、报警
日志采集
日志采集这一步主要是在用户端捕获各种错误信息以及一些环境信息，然后上报给服务端。

首先我们要明确平台需要哪些数据，除了最基本的错误信息之外，还需要项目信息、操作系统、浏览器版本和采样率等基础数据。
明确了数据之后就可以开始编写sdk了，下文将从错误信息、项目信息、操作系统、浏览器版本和采样率来分析如何采集。
错误信息常见的错误类型分为五类：运行时报错、资源加 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/tab.github.io/2021/07/08/ssr/" title="性能优化之SSR初体验">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2021/07/08/ssr/ssr.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="性能优化之SSR初体验"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2021/07/08/ssr/" title="性能优化之SSR初体验">性能优化之SSR初体验</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-07-08T06:37:22.000Z" title="发表于 2021-07-08 14:37:22">2021-07-08</time></span></div><div class="content">性能优化之SSR初体验SSR是什么？
Server Side Render简称SSR。具体指html页面内容通过服务端渲染生成，浏览器接收到服务器响应时直接显示对应的内容就可以了。


了解完SSR就必须知道和它相爱相杀的CSR。CSR全称Client Side Render，页面上的内容是js动态渲染出来的（Vue、React等框架），服务端只返回一个html模板，其余渲染在浏览器完成。

SSR也不算是一个新的概念，早期的后端PHP、JAVA就已经支持服务端渲染，美其名曰模板引擎，如phtml、jsp、jade等。最近几年前端工程化的日渐成熟，前后端开始分离，将原本的SSR模式转变成了CSR。同时也带来了一些性能上的缺陷以及SEO问题等等。
SSR优劣势对比上面两张图SSR的优势很明显，在进行到第二阶段下载js文件时页面已经呈现，而CSR需要到第四阶段可交互时才显示页面。这对于首屏性能和**搜索引擎SEO**有着天然的好处。
当然SSR的劣势不小，对于现有的Vue或者React项目迁移成本很大；消耗服务器资源；框架生态支持不太完美。
从个人经验上来说，除非对项目首屏性能或者SEO有 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/tab.github.io/2021/05/15/inject/" title="Vue3.0——Provide/Inject的妙用">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2021/05/15/inject/top.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="Vue3.0——Provide/Inject的妙用"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2021/05/15/inject/" title="Vue3.0——Provide/Inject的妙用">Vue3.0——Provide/Inject的妙用</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-05-15T15:07:43.000Z" title="发表于 2021-05-15 23:07:43">2021-05-15</time></span></div><div class="content">Vue3.0——Provide/Inject的妙用说起Vue的状态管理工具，应该大部分人都会想到Vuex，毕竟是官方提供的工具，但是都进入Vue3时代了，不会还有人不知道依赖注入吧。为什么会突然提到依赖注入呢？跟状态管理工具有什么关系呢？当然有关系，因为依赖注入在Vue3中可以替代Vuex。我们知道Vue3提供的ref/reactive API具有组件解耦的特性，也就是说我们可以在组件之外创建响应式数据，这么一来跨组件共享数据的需求就在Vue3新框架内部得到了解决。
Provide / Inject
通常，当我们需要从父组件向子组件传递数据时，我们使用 props。如果组件层级比较深，那通过props传递下去会比较麻烦。针对这种情况我们可以使用一对 provide 和 inject。无论组件层次结构有多深，父组件都可以作为其所有子组件的依赖提供者。这个特性有两个部分：父组件有一个 provide 选项来提供数据，子组件有一个 inject 选项来开始使用这些数据。

Provide / Inject不是什么新的api，在Vue2的时候就已经存在了，只不过在Vue3得到新的应用。这里只做 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/tab.github.io/2021/02/23/vue3-reactive-ref/" title="Vue3.0——reactive和ref原理">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2021/02/23/vue3-reactive-ref/reactive.png" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="Vue3.0——reactive和ref原理"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2021/02/23/vue3-reactive-ref/" title="Vue3.0——reactive和ref原理">Vue3.0——reactive和ref原理</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-02-23T02:44:22.000Z" title="发表于 2021-02-23 10:44:22">2021-02-23</time></span></div><div class="content">Vue3.0——reactive和ref原理Vue3采用了新的Proxy实现数据拦截，但Proxy还是只能代理一层。对于深层的对象需要递归代理，相比2.0在初始化递归，3.0的运行时递归，大大减少了初始化的递归性能消耗。
Proxy首先简单了解下Proxy，方便后面学习reactive和ref原理。

Proxy 对象用于创建一个对象的代理，从而实现基本操作的拦截和自定义（如属性查找、赋值、枚举、函数调用等）。

基础示例：
12345678910111213141516171819202122232425const handler = &#123;    // 属性读取操作的捕捉器    get: function (target, prop) &#123;    	console.log(&#x27;getting key: &#x27; + prop);        return target[prop];    &#125;,    // 属性设置操作的捕捉器    set: function (target, prop, value) &#123;    	console. ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/tab.github.io/2020/03/18/css_var/" title="css变量那些事">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2020/03/18/css_var/topbg.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="css变量那些事"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2020/03/18/css_var/" title="css变量那些事">css变量那些事</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-03-18T02:35:42.000Z" title="发表于 2020-03-18 10:35:42">2020-03-18</time></span></div><div class="content">  css变量也不是一个新词，但是说起css变量可能很多同学都不太熟悉，因为它的使用场景确实不太多，做过皮肤切换功能的同学估计是了解css变量带来的好处（变量是个好东西）。
浏览器支持   开始之前先了解下css变量的兼容性，避免一顿操作猛如虎，一看兼容泪满面。现在市面上主流的浏览器基本上都支持（IE6这玩意别跟我说主流），全球网站流量的 77％ 支持CSS变量，而美国已经接近90％。   
声明你的第一个css变量既然是变量，那么可以大胆的猜测它一定有作用域(后面会讲到)。我们先在全局也就是 :root  上定义，也意味着所有的DOM节点都能使用到全局的变量。
123:root &#123;  --title-color: #1b1b1b;  &#125;
声明变量的语法是  --* ，至于命名规则就比较有意思了，css变量命名除了不能包含 $ ，[ ， ^，(，%等字符之外都是可以，甚至中文字也行。
使用你的第一个css变量刚刚我们已经在全局声明了一个--title-color，那么现在我们可以在任意位置去使用到它。
123.card-title &#123;    color:  ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/tab.github.io/2019/11/18/computed/" title="computed 实现原理">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2019/11/18/computed/topbg.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="computed 实现原理"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2019/11/18/computed/" title="computed 实现原理">computed 实现原理</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-18T02:35:42.000Z" title="发表于 2019-11-18 10:35:42">2019-11-18</time></span></div><div class="content">computed 实现原理
模板内的表达式非常便利，但是设计它们的初衷是用于简单运算的。在模板中放入太多的逻辑会让模板过重且难以维护。计算属性是基于它们的响应式依赖进行缓存的。只在相关响应式依赖发生改变时它们才会重新求值

那么计算属性为何可以做到当它的依赖项发生改变时才会进行重新的计算，否则当前数据是被缓存的？
使用123456789101112131415161718192021export default &#123;  computed: &#123;    // function    status() &#123;      return this.$store.state.status    &#125;,    // getter    fullName: &#123;      // getter      get: function() &#123;        return this.firstName + &#x27; &#x27; + this.lastName      &#125;,      // setter      set: function(n ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/tab.github.io/2019/11/11/vue-directive/" title="vue自定义指令的魅力">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2019/11/11/vue-directive/2701794-250949a6bda06b20.png" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="vue自定义指令的魅力"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2019/11/11/vue-directive/" title="vue自定义指令的魅力">vue自定义指令的魅力</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-11-11T02:38:31.000Z" title="发表于 2019-11-11 10:38:31">2019-11-11</time></span></div><div class="content">vue自定义指令的魅力默认的内置指令：v-html、v-if、v-show、v-for等，除此之外vue允许注册自定义指令。

指令格式：v-name:arg.modifier=”value”

 v-on:click.stop = &#39;clickFn&#39;（简写@click.stop=&quot;clickFn&quot;）
指令定义函数提供了几个钩子函数：

bind-只调用一次，指令第一次绑定到元素时调用
insert
update-当前绑定元素有任意改变时触发
componentUpdated
unbind-只调用一次，指令与元素解绑时调用(dom节点移除时调用，v-if)

滚动条实例产品需求：默认情况下滚动条不展示，滚动起来才出现滚动条注册指令
123456789101112131415Vue.directive(&#x27;scroll&#x27;, &#123;    bind(el, binding)&#123;        // binding = &#123; name, arg, value, modifiers, oldValue &#125;   ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/tab.github.io/2019/10/30/fe-crawler/" title="前端与反爬虫">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2019/10/30/fe-crawler/topbg.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="前端与反爬虫"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2019/10/30/fe-crawler/" title="前端与反爬虫">前端与反爬虫</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-10-30T10:49:46.000Z" title="发表于 2019-10-30 18:49:46">2019-10-30</time></span></div><div class="content">前端与反爬虫
爬虫爬取数据主要是从 dom 节点上获取的，那么我们前端可以在 dom 节点上搞点骚操作来干扰爬虫抓取数据

1.1 字符串穿插在 html 字符间插入无关紧要的元素来达到干扰爬虫的效果
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647/** * 获取随机中文字 */const randomText = () =&gt; &#123;    let _len = 2    let i = 0    let _str = &#x27;&#x27;    let _base = 20000    let _range = 1000    while (i &lt; _len) &#123;        i++        var _lower = parseInt(Math.random() * _range)        _str += String.fromCharCode(_base + _lower)    &#125;    return  ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/tab.github.io/2019/09/26/state-pattern/" title="状态模式">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2019/09/26/state-pattern/rollingLoad.png" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="状态模式"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2019/09/26/state-pattern/" title="状态模式">状态模式</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-09-26T06:57:23.000Z" title="发表于 2019-09-26 14:57:23">2019-09-26</time></span></div><div class="content">状态模式
状态模式允许一个对象在其内部状态改变的时候改变它的行为，对象看起来似乎修改了它的类

1234const obj = &#123;  state: &#x27;&#x27;  action()&#123;&#125;&#125;

对象的行为取决于它的状态，并且它必须在运行时刻根据状态改变它的行为
简单实现王者荣耀就可能同时有好几个状态（攻击，移动，回城，死亡）等
1234567891011121314// if-else款const change = state =&gt; &#123;  if (state == &#x27;攻击&#x27;) &#123;    console.log(&#x27;攻击&#x27;)  &#125; else if (state == &#x27;移动&#x27;) &#123;    console.log(&#x27;移动&#x27;)  &#125; else if (state == &#x27;回城&#x27;) &#123;    console.log(&#x27;回城&#x27;)  &#125; else if (st ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/tab.github.io/2019/09/05/vue-cli-service/" title="vue-cli-service">     <img class="post_bg" src= "" data-lazy-src="/tab.github.io/2019/09/05/vue-cli-service/topbg.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="vue-cli-service"></a></div><div class="recent-post-info"><a class="article-title" href="/tab.github.io/2019/09/05/vue-cli-service/" title="vue-cli-service">vue-cli-service</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2019-09-05T01:46:34.000Z" title="发表于 2019-09-05 09:46:34">2019-09-05</time></span></div><div class="content">vue-cli-service 机制npm run dev 之后发生了些什么？？？
入口从package.json里面可以看到npm run dev其实就是vue-cli-service serve
vue-cli3.0 安装的时候把vue-cli-service一并安装了，即执行了npm install vue-cli-service --save-dev
这样就可以在./node_modules/.bin目录下查看到vue-cli-service
1234567@IF EXIST &quot;%~dp0\node.exe&quot; (  &quot;%~dp0\node.exe&quot;  &quot;%~dp0\..\@vue\cli-service\bin\vue-cli-service.js&quot; %*) ELSE (  @SETLOCAL  @SET PATHEXT=%PATHEXT:;.JS;=;%  node  &quot;%~dp0\..\@vue\cli-service\bin\vue-cli-service.js&quot; %*)


入口：./nod ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src= "" data-lazy-src="/tab.github.io/images/avatar.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">Tab</div><div class="author-info__description">Tab</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/tab.github.io/archives/"><div class="headline">文章</div><div class="length-num">10</div></a></div><div class="card-info-data-item is-center"><a href="/tab.github.io/tags/"><div class="headline">标签</div><div class="length-num">7</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/Tabxx"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/tab.github.io/2021/08/09/femonitor/" title="前端异常监控平台"><img src= "" data-lazy-src="/tab.github.io/2021/08/09/femonitor/IMG_2992.jpeg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="前端异常监控平台"/></a><div class="content"><a class="title" href="/tab.github.io/2021/08/09/femonitor/" title="前端异常监控平台">前端异常监控平台</a><time datetime="2021-08-09T12:25:00.000Z" title="发表于 2021-08-09 20:25:00">2021-08-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/tab.github.io/2021/07/08/ssr/" title="性能优化之SSR初体验"><img src= "" data-lazy-src="/tab.github.io/2021/07/08/ssr/ssr.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="性能优化之SSR初体验"/></a><div class="content"><a class="title" href="/tab.github.io/2021/07/08/ssr/" title="性能优化之SSR初体验">性能优化之SSR初体验</a><time datetime="2021-07-08T06:37:22.000Z" title="发表于 2021-07-08 14:37:22">2021-07-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/tab.github.io/2021/05/15/inject/" title="Vue3.0——Provide/Inject的妙用"><img src= "" data-lazy-src="/tab.github.io/2021/05/15/inject/top.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="Vue3.0——Provide/Inject的妙用"/></a><div class="content"><a class="title" href="/tab.github.io/2021/05/15/inject/" title="Vue3.0——Provide/Inject的妙用">Vue3.0——Provide/Inject的妙用</a><time datetime="2021-05-15T15:07:43.000Z" title="发表于 2021-05-15 23:07:43">2021-05-15</time></div></div></div></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tab.github.io/tags/CLI/" style="font-size: 1.1em; color: #999">CLI</a> <a href="/tab.github.io/tags/CSS/" style="font-size: 1.1em; color: #999">CSS</a> <a href="/tab.github.io/tags/SSR/" style="font-size: 1.1em; color: #999">SSR</a> <a href="/tab.github.io/tags/Vue/" style="font-size: 1.5em; color: #99a9bf">Vue</a> <a href="/tab.github.io/tags/%E5%89%8D%E7%AB%AF%E8%BF%90%E7%BB%B4/" style="font-size: 1.1em; color: #999">前端运维</a> <a href="/tab.github.io/tags/%E5%AE%89%E5%85%A8/" style="font-size: 1.1em; color: #999">安全</a> <a href="/tab.github.io/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" style="font-size: 1.1em; color: #999">设计模式</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2021/08/"><span class="card-archive-list-date">八月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2021/07/"><span class="card-archive-list-date">七月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2021/05/"><span class="card-archive-list-date">五月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2021/02/"><span class="card-archive-list-date">二月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2020/03/"><span class="card-archive-list-date">三月 2020</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2019/11/"><span class="card-archive-list-date">十一月 2019</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2019/10/"><span class="card-archive-list-date">十月 2019</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/tab.github.io/archives/2019/09/"><span class="card-archive-list-date">九月 2019</span><span class="card-archive-list-count">2</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">10</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2019-08-31T16:00:00.000Z"></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">17.8k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2021-08-13T09:11:40.491Z"></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By Tab</div><div class="footer_custom_text">Hi, welcome to my <a href="https://tabxx.github.io/tab.github.io/">blog</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/tab.github.io/js/utils.js"></script><script src="/tab.github.io/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>